<template>
  <view>
    <view class="list-container">
      <view class="item">
        <view class="top-label" @click="retractItem">
          <view>学校信息</view>
          <view v-if="viewItem.show"><uv-icon name="arrow-down" size="40rpx" color="#000000"></uv-icon></view>
          <view v-else><uv-icon name="arrow-right" size="40rpx" color="#000000"></uv-icon></view>
        </view>
        <view v-if="viewItem.show" class="info">
          <view class="row">
            <view class="title">学校名称:</view>
            <view class="con">{{ form.name||"--" }}</view>
          </view>
          <view class="row">
            <view class="title">所属区域:</view>
            <view class="con">{{ form.addressAll||"--" }}</view>
          </view>
          <view class="row">
            <view class="title">学校地区类型:</view>
            <view class="con">{{ form.distinctTypeName||"--" }}</view>
          </view>
          <view class="row">
            <view class="title">学校办学类型:</view>
            <view class="con">{{ form.doSchoolTypeName||"--" }}</view>
          </view>
          <view class="row">
            <view class="title">学校教师总人数:</view>
            <view class="con">{{ form.teacherAmount||"--" }}</view>
          </view>
          <view class="row">
            <view class="title" style="width: 300rpx;">学校供餐模式:</view>
            <view class="con">{{ form.canteenFlag == '1' ? '外部供餐' : '自有食堂' }}</view>
          </view>
          <view class="row">
            <view class="title">校长姓名:</view>
            <view class="con">{{ form.masterName||"--" }}</view>
          </view>
          <view class="row">
            <view class="title">详细地址:</view>
            <view class="con">{{ form.address||"--" }}</view>
          </view>
          <view class="row">
            <view class="title" style="width: 300rpx;">社会统一信号代码:</view>
            <view class="con">{{ form.orgCode||"--" }}</view>
          </view>
          <view class="row">
            <view class="title">学校办学性质:</view>
            <view class="con">{{ form.schoolPropertiesName||"--" }}</view>
          </view>
          <view class="row">
            <view class="title">学校学生总人数:</view>
            <view class="con">{{ form.studentAmount||"--" }}</view>
          </view>
          <view class="row">
            <view class="title">AI监控:</view>
            <view class="con">{{ form.cameraFlag == '1' ? '是' : '否' }}</view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import {ref, reactive, defineProps, getCurrentInstance} from "vue";
const {proxy} = getCurrentInstance();
import publicAPI from "@/api/law/public/public";
import {onShow} from "@dcloudio/uni-app";
const viewItem = reactive({show: false})
const form = ref({})
const props = defineProps({
  schoolId: {
    type: String,
    default: null
  }
});

function retractItem() {
  viewItem.show = !viewItem.show
}

let getSchoolList = async () => {
  let res = await proxy.http.asyncGet(publicAPI.getOrgSchoolNoTenantInfo(props.schoolId));
  if (res.code === 0) {
    form.value = {...res.data};
  } else {
    await uni.showToast({title: res.msg, icon: 'none'});
  }
};
onMounted(() => {
  getSchoolList();
})
</script>

<style lang="scss" scoped>
//公用样式文件
@import "@/static/css/packageBase/smain.scss";
@import "@/static/css/packageBase/lmain.scss";
//日常检查样式
@import "@/static/css/dailycheck/dailycheck.scss";
@import "@/static/css/dailycheck/viewIndex.scss";
.title {
  width: 35vw!important;
}
</style>